module.exports = function(grunt) {
	require('load-grunt-tasks')(grunt); // 

	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		babel: {
			options: {
				sourceMap: true,
				presets: ['@babel/preset-env']
			},
			dist: {
				files: [{
					'dist/global2015.js': './global.js'
				}]
			}
		},
		concat: {
			options: {
				separator: ';'
			},
			dist: {
				src: ['src/test.js', 'src/test1.js'],
				dest: './global.js'
			}
		},
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */'
			},
			build: {
				src: 'dist/global2015.js',
				dest: 'build/<%=pkg.name%><%pkg.version%>.min.js'
			}
		},
		clean: {
			build: {
				src: ["dist/*"]
			}
		},
		jsdoc: {
			dist: {
				src: ['./global.js'],
				options: {
					destination: 'doc'
				}
			}
		},
		watch: {
		  build:{
				files:['./global.js'],
				tasks:['jsdoc'],
				options:{
					spawn:false
				}
			}
		}
	});
	grunt.loadNpmTasks('grunt-jsdoc');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.registerTask('default', ['concat', 'babel', 'uglify', 'clean','jsdoc','watch']);
}
